import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-03-21
 * Time: 17:23
 */
public class Main3 {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        int count = 0;
        for (int i = 0; i < n; i++) {
            while (i + 1 < n && arr[i] == arr[i + 1]) {
                i++;
            }
            if (i + 1 < n && arr[i] < arr[i + 1]) {
                while (i + 1 < n && arr[i] < arr[i + 1]) {
                    i++;
                }
            } else {
                while (i + 1 < n && arr[i] > arr[i + 1]) {
                    i++;
                }
            }
            count++;
        }
        System.out.println(count);
    }
}
